package com.hk.employeemanagementsystem.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hk.employeemanagementsystem.entity.UserEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author by 何坤
 * @Classname UserEntityMapper
 * @Description TODO
 * @Date 2019/12/19 10:59
 */
@Mapper
public interface UserEntityMapper extends BaseMapper<UserEntity> {
    /**
     * 根据用户的手机号查询出用户的相关信息以及用户的角色
     * @param phone
     * @return com.hk.employeemanagementsystem.entity.UserEntity
     * @date 2019/12/19 15:39
     * @author 何坤
     */
    UserEntity getUserByPhone(@Param("phone") String phone);

    UserEntity getUserById(@Param("userId") Integer userId);

    List<UserEntity> selectUserByKeyword(@Param("keyword") String keyword);

    void updateUserEnableById(@Param("userId") Integer userId, @Param("enable") Boolean enable);

    int deleteRoleByUserPhone(@Param("phone") String phone);

    int addRolesForUser(@Param("phone") String phone, @Param("rids") Integer[] rids);
}
